package com.luweijie.service.impl;


import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.luweijie.mappre.ResourceMapper;
import com.luweijie.pojo.Resource;
import com.luweijie.pojo.User;
import com.luweijie.service.IResourceService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
@Slf4j
public class ResourceService extends ServiceImpl<ResourceMapper, Resource> implements IResourceService {
@Autowired
AUserService userService;

    @Override
    public List<Resource> getAll() {
        return this.list();
    }

    @Override

    public String query(String username) {
        //根据用户名查询到用户所拥有的角色
        User byUniqueId =  userService.getByUniqueId(username);
        String role = byUniqueId.getRole();
        log.debug("用户的角色为"+role);
        return  role ;
    }
}
